package edu.ccut.saturn.basecomponent.database;

import java.util.HashMap;
import java.util.Map;

import edu.ccut.saturn.basecomponent.database.impl.db2.DB2Attribute;
import edu.ccut.saturn.basecomponent.database.impl.hsql.HsqlAttribute;
import edu.ccut.saturn.basecomponent.database.impl.mysql.MysqlAttribute;
import edu.ccut.saturn.basecomponent.database.impl.oracle.OracleAttribute;
import edu.ccut.saturn.basecomponent.database.impl.sqlserver.SqlServerAttribute;

public class DatabaseAttributeUtils {
	private static Map<String, IDatabaseAttribute> databaseSets = new HashMap<String, IDatabaseAttribute>();
	
	static{
		initalSets();
	}

	private static void initalSets() {
		databaseSets.put(SaturnSQLBuilderFactory.DB2, new DB2Attribute());
		databaseSets.put(SaturnSQLBuilderFactory.MYSQL, new MysqlAttribute());
		databaseSets.put(SaturnSQLBuilderFactory.ORACLE, new OracleAttribute());
		databaseSets.put(SaturnSQLBuilderFactory.SQLSERVER, new SqlServerAttribute());
		databaseSets.put(SaturnSQLBuilderFactory.HSQL, new HsqlAttribute());
	}
	
	public static IDatabaseAttribute getDatabaseAttribute(String dbType){
		
		return databaseSets.get(dbType.toLowerCase());
	}
}
